<?php
/**
 * Created by PhpStorm.
 * User: sunshine
 * Date: 2016/8/31
 * Time: 14:48
 */

require_once ('Admin/View/template/inc_admin.php');

?>

<div class="col-md-10  col-xs-12 col-sm-10 col-sm-offset-1 col-md-offset-1 col-xs-offset-1"  style="position: relative;top: 50px;"  >
    <h2 style="color: #03c2f9; margin-bottom: 0px;padding-bottom: 0px;"><p class="bg-white" style="margin-bottom: 10px;margin-top: 10px" >多选题列表</p></h2>
    <h4><p class="bg-info" style="margin-top:0px ;padding:10px" ><a href="admin.php" style="color: white">首页&nbsp;</a>/&nbsp;多选题列表</p></h4>
</div>
<?php if(!empty($data['test'])) { ?>

<div class="container-fluid control-label  col-md-12 ">
    <table class="table table-hover" style="width: 800px;margin-top:150px; color: #0a0a0a;font-size: 20px;font-family: 微软雅黑">
        <tr  class="danger">
            <th  style="padding-left: 50px;background-color: #eee;">题号</th>
            <th style="padding-left: 50px;background-color: #eee;">试卷名</th>
            <th style="padding-left: 50px;background-color: #eee;">内容</th>
            <th style="padding-left: 50px;background-color: #eee;">选项A</th>
            <th style="padding-left: 50px;background-color: #eee;">选项A图片</th>
            <th style="padding-left: 50px;background-color: #eee;">选项B</th>
            <th style="padding-left: 50px;background-color: #eee;">选项B图片</th>
            <th style="padding-left: 50px;background-color: #eee;">选项C</th>
            <th style="padding-left: 50px;background-color: #eee;">选项C图片</th>
            <th style="padding-left: 50px;background-color: #eee;">选项D</th>
            <th style="padding-left: 50px;background-color: #eee;">选项D图片</th>
            <th style="padding-left: 50px;background-color: #eee;">答案</th>
            <th style="background-color: #eee;">操作</th>
        </tr>

        <?php

foreach ($data['test'] as $row)  { 
                if (is_array($row)) {
                    echo ' <tr class="success"  >';
                    echo '<td style="padding-left: 60px">' . $row['d_id'] . '</td>';
                    echo '<td style="padding-left: 60px">' . $row['pid'] . '</td>';
                    echo '<td style="padding-left: 60px">' . $row['content'] . '</td>';
                    echo '<td style="padding-left: 60px">' . $row['op1'] . '</td>';
                    echo '<td style="padding-left: 60px">' . '<img src="upload/' . $row['pic1'] . '" width="60px" height="50px" alt="无图">' . '</td>';
                    echo '<td style="padding-left: 60px">' . $row['op2'] . '</td>';
                    echo '<td style="padding-left: 60px">' . '<img src="upload/' . $row['pic2'] . '" width="60px" height="50px" alt="无图">' . '</td>';
                    echo '<td style="padding-left: 60px">' . $row['op3'] . '</td>';
                    echo '<td style="padding-left: 60px">' . '<img src="upload/' . $row['pic3'] . '" width="60px" height="50px" alt="无图">' . '</td>';
                    echo '<td style="padding-left: 60px">' . $row['op4'] . '</td>';
                    echo '<td style="padding-left: 60px">' . '<img src="upload/' . $row['pic4'] . '" width="60px" height="50px" alt="无图">' . '</td>';
                    echo '<td style="padding-left: 60px">' . $row['ans'] . '</td>';
                    echo '<td><button class="btn btn-info" style="font-family: 微软雅黑;margin-top:10px; padding-left:11px; background-color:#90EE90;width:50px;height:30px"><a style="color:black;" href="admin.php?c=d_test&m=mod&id=' . $row['d_id'] . ' ">修改</a></button>
	 <button class="btn btn-danger" style="font-family: 微软雅黑;margin-top:10px;padding-left:11px; background-color:#E9967A;width:50px;height:30px"><a style="color:black;" href="admin.php?c=d_test&m=del&id=' . $row['d_id'] . '" onClick="return confirm(\'确定要删除吗？\');">删除</a></button></td>';
                    echo '</tr>';
                } else {
                    $totalrows = 1;
                    echo ' <tr class="success"  >';
                    echo '<td style="padding-left: 60px">' . $data['test']['d_id'] . '</td>';
                    echo '<td style="padding-left: 60px">' . $data['test']['pid'] . '</td>';
                    echo '<td style="padding-left: 60px">' . $data['test']['content'] . '</td>';
                    echo '<td style="padding-left: 60px">' . $data['test']['op1'] . '</td>';
                    echo '<td style="padding-left: 60px">' . '<img src="upload/' . $data['test']['pic1'] . '" width="60px" height="50px" alt="无图">' . '</td>';
                    echo '<td style="padding-left: 60px">' . $data['test']['op2'] . '</td>';
                    echo '<td style="padding-left: 60px">' . '<img src="upload/' . $data['test']['pic2'] . '" width="60px" height="50px" alt="无图">' . '</td>';
                    echo '<td style="padding-left: 60px">' . $data['test']['op3'] . '</td>';
                    echo '<td style="padding-left: 60px">' . '<img src="upload/' . $data['test']['pic3'] . '" width="60px" height="50px" alt="无图">' . '</td>';
                    echo '<td style="padding-left: 60px">' . $data['test']['op4'] . '</td>';
                    echo '<td style="padding-left: 60px">' . '<img src="upload/' . $data['test']['pic4'] . '" width="60px" height="50px" alt="无图">' . '</td>';
                    echo '<td style="padding-left: 60px">' . $data['test']['ans'] . '</td>';
                    echo '<td><button class="btn btn-info" style="font-family: 微软雅黑;margin-top:10px; padding-left:11px; background-color:#90EE90;width:50px;height:30px"><a style="color:black;" href="admin.php?c=d_test&m=mod&id=' . $data['test']['d_id'] . ' ">修改</a></button>
	 <button class="btn btn-danger" style="font-family: 微软雅黑;margin-top:10px;padding-left:11px; background-color:#E9967A;width:50px;height:30px"><a style="color:black;" href="admin.php?c=d_test&m=del&id=' . $data['test']['d_id'] . '" onClick="return confirm(\'确定要删除吗？\');">删除</a></button></td>';
                    echo '</tr>';
                    break;
                }
            }
            echo '</table>';
            if ($totalrows != 1)
                $totalrows = count($data['test']);
            echo '<h2 style="font-family:微软雅黑;text-align:right;color:red">共有' . $totalrows . '道多选题</h2>';
        }
        else
        {
            echo "<h2 style='margin-top: 250px;margin-left: 360px;color: red;font-family: 微软雅黑'>没有试题</h2>";
            echo '<button class="btn btn-info" style="font-family: 微软雅黑;margin-top:-70px; margin-left:500px; background-color:#90EE90;width:150px;height:40px"><a style="color:black" href="admin.php?c=d_test&m=form">点击这里添加试题</a></button>';
        }
        ?>
</div>
</body>
</html>